<template>
    <div>
        <button @click="isShow =!isShow">显示/隐藏</button>
        <transition  name="hello" appear="true">
            <!--appear="true"：一开始也会有启动动画-->
            <h1 v-show="isShow">Hello!</h1>
        </transition>
    </div>
</template>

<script>
export default {
    name:'T-ests',
    data(){
        return{
            isShow:true
        }
    }
}
</script>

<style scoped>
    h1{
        background-color: pink;
    }

    
    .hello-enter-active{
        /*动画名字是固定的,如果transition的name属性更改了，
            这里的v-也要改为对应的name-*/
        animation: Gui 1s;
    }

    .hello-leave-active{
        animation: Gui 1s reverse;
    }

    @keyframes Gui {
        from{
            transform: translateX(-100%);
        }
        to{
            transform: translateX(0px);
        }
    }
</style>